package day010.anonymous.example;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        ArrayList<User> list = new ArrayList<>();

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username = sc.nextLine();
        System.out.println("请输入手机号码：");
        String phoneNumber = sc.nextLine();
        System.out.println("请输入登录密码：");
        String password = sc.nextLine();
        System.out.println("请输入确认密码：");
        String confirm;
        while (true) {
            confirm = sc.nextLine();
            if (password.equals(confirm)) {
                break;
            } else {
                System.out.println("您输入的登录密码和确认密码不一致，请重新输入...");
            }
        }
        System.out.println("请输入电子邮箱：");
        String email = sc.nextLine();
        System.out.println("请输入性别：");
        String sex = sc.nextLine();
        System.out.println("请输入出生日期：");
        String birthday = sc.nextLine();

        list.add(new User(username, phoneNumber, password, confirm, email, sex, birthday));

        for (int i = 0; i < list.size(); i++) {
            User u = list.get(i);
            System.out.println(u.getUsername() + "---" + "---" +
                    u.getPassword() + "---" + u.getConfirm() + "---" + u.getEmail() + "---" +
                    u.getSex() + "---" + u.getBirthday());
        }
    }
}
